package 蓝桥真题;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class 后缀表达式 {
       static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
       final static int N=200010;
       static int a[]=new int[N],n,m;
       
       public static void main(String[] ss) throws IOException {
		      ss=br.readLine().split(" ");
		      n=Integer.parseInt(ss[0]);m=Integer.parseInt(ss[1]);
		      ss=br.readLine().split(" ");
		      int k=n+m+1;
		      for(int i=0;i<k;i++)
		    	  a[i]=Integer.parseInt(ss[i]);
		      Arrays.sort(a,0,k);
		      long res=a[k-1];
		      
		      for(int i=k-2;i>=0;i--){
		    	  if(n-->0){
		    		  res+=a[i];
		    	  }else if(m-->0)res-=a[i];
		      }
		      System.out.print(res);
	}
}
